package com.ruoyi.syf.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.syf.domain.HolidayInfo;
import com.ruoyi.syf.domain.RiskShutdownRecord;
import com.ruoyi.syf.domain.vo.HolidayInfoVo;
import com.ruoyi.syf.service.HolidayInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;

/**
 * 日历
 *
 * @author yr
 * @date 2024-08-25
 */
@RestController
@RequestMapping("/syf/holidayInfo")
public class HolidayInfoController  extends BaseController{

    @Autowired
    private HolidayInfoService holidayInfoService;

    /**
     * 日历查询
     */
    @GetMapping("/list")
    public AjaxResult list(HolidayInfoVo vo) {
        return AjaxResult.success(holidayInfoService.selectHolidayInfoList(vo));
    }

    /**
     * 设置工作日
     */
    @Log(title = "日历", businessType = BusinessType.UPDATE)
    @PutMapping("/week/{id}")
    public AjaxResult week(@PathVariable("id") Long id) {
        return toAjax(holidayInfoService.week(id));
    }

    /**
     * 设置节假日
     */
    @Log(title = "日历", businessType = BusinessType.UPDATE)
    @PutMapping("/holiday/{id}")
    public AjaxResult holiday(@PathVariable("id") Long id) {
        return toAjax(holidayInfoService.holiday(id));
    }

    /**
     * 设置调休
     */
    @Log(title = "日历", businessType = BusinessType.UPDATE)
    @PutMapping("/adjust/{id}")
    public AjaxResult adjust(@PathVariable("id") Long id) {
        return toAjax(holidayInfoService.adjust(id));
    }

}
